package AudioTool;
import java.applet.*;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import java.io.File;
import java.util.HashMap;

/**
 *
 * @author yk
 */
public class MusicPool {
    HashMap<String, ClipPlayer> hc=new HashMap<String, ClipPlayer>();
    private void blendMusic()
    {
       hc.put("exp.WAV",new ClipPlayer(new File("exp.WAV")));     
    }
    public MusicPool()
    {
        blendMusic();
    }
    public void playloop(String file,int time)//在时间长度time内循环播放
    {
        ClipPlayer p=hc.get(file);
        p.setreplay(true);
        p.play();
         try {
              new Thread().sleep(time);
        } catch (InterruptedException ex) {
           ex.printStackTrace();
        }
    }
    public void play(String file,int time)//在时间长度time内单次播放
    {
        ClipPlayer p=hc.get(file);
        p.setreplay(false);
        p.play();
         try {
              new Thread().sleep(time);
        } catch (InterruptedException ex) {
           ex.printStackTrace();
        }
    }
   
}
